﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Web;

using Com.Framework.Cookie;
using Com.Framework.Enc;

namespace Com.Library.Cookie
{
    public class ManagerCookie : BaseCookie
    {
        public ManagerCookie()
            : base(CookieUtil.DomainName)
        {
            GetCookie();
        }

        private string m_ManagerName = string.Empty;
        public string ManagerName
        {
            get { return m_ManagerName; }
        }

        private string m_ManagerID = string.Empty;
        public string ManagerID
        {
            get { return m_ManagerID; }
        }

		private int m_ManagerSN = 0;
		public int ManagerSN
		{
			get { return m_ManagerSN; }
		}

        public bool IsLogin
        {
            get
            {
                return this.m_ManagerID == string.Empty ? false : true;
            }
        }

        private string m_MSC = string.Empty;
        private void GetCookie()
        {
            if (m_MSC == string.Empty)
            {
                m_MSC = GetEncCookie("MSC");
            }
            this.m_ManagerID = GetData(m_MSC, "ManagerID");
            this.m_ManagerName = GetData(m_MSC, "ManagerName");
			string managerSNStr = GetData(m_MSC, "ManagerSN");
			this.m_ManagerSN = string.IsNullOrEmpty(managerSNStr)?0:Convert.ToInt32(managerSNStr);
        }

        public void ResetCookie()
        {
            GetCookie();
        }
    }
}
